Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update trigger_observers to operate over slices of data #14354

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

mnmaita
Copy link
Member

@mnmaita mnmaita commented Jul 16, 2024

Objective

Solution

  • Updated trigger_observers signature to operate over a slice instead of an Iterator.
  • Updated calls to trigger_observers to match the new signature.

Migration Guide

  • TBD

@mnmaita
Copy link
Member Author

mnmaita commented Jul 16, 2024

@alice-i-cecile does this look correct to you to fix the issue?

@janhohenheim janhohenheim added D-Trivial Nice and easy! A great choice to get started with Bevy A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 17, 2024
Copy link
Member

@janhohenheim janhohenheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't comment on whether the underlying issue makes sense as I'm out of the loop, but this implementation fits the required specification perfectly.

@@ -842,11 +838,11 @@ impl<'w> BundleInserter<'w> {
unsafe {
deferred_world.trigger_on_add(new_archetype, entity, add_bundle.added.iter().cloned());
if new_archetype.has_add_observer() {
deferred_world.trigger_observers(ON_ADD, entity, add_bundle.added.iter().cloned());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the change we're looking for :D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alice-i-cecile @NthTensor Now curious about trigger_on_add and trigger_on_insert, should these get the same treatment? I also didn't have full context around the "whys" so maybe there's a reason to just apply it to specific methods.

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you :)

@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 17, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jul 17, 2024
Merged via the queue into bevyengine:main with commit 72e7a4f Jul 17, 2024
34 checks passed
@NthTensor
Copy link
Contributor

Thank you for picking this up! Looks great.

@mnmaita mnmaita deleted the mnmaita/issue-14333 branch July 17, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

trigger_observers should operate on slices of data
4 participants